﻿
@{ Layout = "~/Views/Shared/_leftPanelLayout.cshtml";}
@section LeftTree
{
     
    @{
        Html.RenderPartial("DeptTreePartialView", new Webcar.Models.DeptTreeMode { Action = "MotoList", Controller = "Driver", ShowChild = true });
     }
}

@using (Ajax.BeginForm("ListPartialView", "Driver",Html.ViewContext.RouteData.Values, new AjaxOptions
    {
        HttpMethod = "POST",
        UpdateTargetId = "list-car",
        //OnBegin = "function{ showLoading();}",
        //OnComplete = "function(){ alert('sdsdsd'); }",
        InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace
    }))
    { 
        @UserQuery.CreateQuery(setting => {
           setting.Columns.Add(new QueryColumn() { Field = "MAN_NAME", Name = "驾驶员" });
           setting.Columns.Add(new QueryColumn() { Field = "ID", Name = "身份证号" });
           setting.Columns.Add(new QueryColumn() { Field = "JOB_KIND", Name = "用工类别", DataType = TypeofQueryColumn.DropDownList, CallBackAction = Url.Action("QueryJobKind", "Common") });
           setting.Columns.Add(new QueryColumn() { Field = "ARCHIVES_NO", Name = "档案号" });
           setting.Columns.Add(new QueryColumn() { Field = "DRIVE_NO", Name = "驾照号" });
           setting.Columns.Add(new QueryColumn() { Field = "DRIVE_KIND", Name = "准驾车型" });
           setting.Columns.Add(new QueryColumn() { Field = "IN_DATE", Name = "聘用日期", DataType = TypeofQueryColumn.Date });
        })
}

<div id="list-car">
    @Html.Action("ListPartialView")
</div>
<hr />
<input value="增加驾驶员" class="webcar-button" type="button" onclick="add_driver();" />
<input value="导出Excel" class="webcar-button" type="button" onclick="export_xls();" />
@* @Html.DevExpress().Button(settings =>
{
    settings.Name = "Button1";
    settings.Text = "增加驾驶员";
    settings.Width = 120;
    settings.ControlStyle.CssClass = "button1";
    settings.ClientSideEvents.Click = "function(s, e){ add_driver(); }";
}).GetHtml()*@
<script type="text/javascript">
    var mancode = null;
    var dept = null;
    function add_driver()
    {
        mancode = "";
        dept = '@Html.ViewContext.RouteData.Values["id"]';
        pcModalMode.Show();
    }
    function export_xls() {
        location.href = '@Url.Action("Export", "Driver", Html.ViewContext.RouteData.Values)';
    }
    function move(id) {
        mancode = id;
        pcModalModeMove.Show();
    }
    function edit(id) {
        mancode = id;
        pcModalMode.Show();
    }
    
    function OnBeginCallback(s, e) {
        e.customArgs["man_code"] = mancode;
        e.customArgs["deptcode"] = dept;
        carNo = "";
        dept = "";
    }
    function OnEndCallback(s, e) {
    }
    function delete_driver(url) {
        if (confirm("删除驾驶员将同时删除驾驶员的所有信息，是否要继续删除？") == false) return;
        location.href = url;
    }
    function delete_driver2(url) {
        if (confirm("是否要删除该驾驶员？") == false) return;
        location.href = url;
    }
</script>



@Html.DevExpress().PopupControl(
settings =>
{
    settings.Name = "pcModalMode";
    settings.CallbackRouteValues = new { Controller = "Driver", Action = "Edit"};
    settings.Width = 610;
    settings.Height = 350;
    settings.InitDefaultSettings();
    settings.HeaderText = "驾驶员信息编辑";
}).GetHtml()

@Html.DevExpress().PopupControl(
settings =>
{
    settings.Name = "pcModalModeMove";
    settings.CallbackRouteValues = new { Controller = "Driver", Action = "Move"};
    settings.Width = 410;
    settings.Height = 320;
    settings.InitDefaultSettings();
    settings.HeaderText = "驾驶员调动";
}).GetHtml()

